package com.bys.admin.system.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bys.admin.system.entity.SysDictType;
import com.bys.response.R;
import com.bys.admin.system.controller.vo.SysDictTypePageVo;
import com.bys.admin.system.service.ISysDictTypeService;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import jakarta.annotation.Resource;

/**
 * <p>
 * 系统字典类型表 前端控制器
 * </p>
 *
 * @author bys
 * @since 2024-04-25
 */
@Tag(name = "系统字典接口")
@RestController
@RequestMapping("/sys-dict-type")
public class SysDictTypeController {
    @Resource
    private ISysDictTypeService sysDictTypeService;

    @Operation(summary="分页查询")
    @GetMapping("/page")
    public R<Page<SysDictType>> page(SysDictTypePageVo vo){
        Page<SysDictType> page = sysDictTypeService.page(new Page<>(vo.getPageNo(), vo.getPageSize()));
        return R.success(page);
    }

    @Operation(summary="保存字典类型")
    @PostMapping("/save")
    public R<Page<SysDictType>> save(@RequestBody  SysDictType dictType){
       sysDictTypeService.save(dictType);
        return R.success();
    }

    @Operation(summary="修改字典类型")
    @PutMapping("/update")
    public R<Page<SysDictType>> update(@RequestBody SysDictType dictType){
        sysDictTypeService.updateById(dictType);
        return R.success();
    }
    @Operation(summary="删除字典类型")
    @DeleteMapping("/delete/{id}")
    public R<Page<SysDictType>> update(@PathVariable Long id){
        sysDictTypeService.removeById(id);
        return R.success();
    }



}
